
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/15 10:19
 */

#include "iostream"
#include "algorithm"

using namespace std;

int main() {
    int n;
    cin >> n;
    int nums[n];
    for (int i = 0; i < n; ++i) {
        cin >> nums[i];
    }
    sort(nums, nums + n);
    int res = 10000;
    for (int i = 0; i < n - 1; ++i) {
        res = min(res, abs(nums[i] - nums[i + 1]));
        if (res == 0) {
            break;
        }
    }
    cout << res;
    return 0;
}